home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / text / tex / amiweb2c.lha / AmiWeb2c-2.1 / texmf / amiweb2c / rexx / MakeTeXls-R.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-03-08  |  3.7 KB  |  115 lines

  1. /*
  2.  * MakeTeXls-R.rexx -- create or rebuild "ls-R".
  3.  *
  4.  * Copyright (C) 1997 by Andreas Scherer
  5.  * This ARexx program is free software; the author gives unlimited
  6.  * permission to copy, distribute, and modify it.
  7.  */
  8.  
  9. Options FailAt 21 /* Handle all error levels in this script */
  10.  
  11. TEMPFILE = "ls-R.temp" /* Intermediate file */
  12. OUTFILE = "ls-R" /* Resulting output file */
  13.  
  14. /*
  15.  * I have been informed about problems with "ls" programs other than
  16.  * "ls 4.7 ljr" as shipped with AmiWeb2c.  Most likely corrupt output
  17.  * is caused by different options.  Unfortunately, both users who
  18.  * reported similar problems refrained from providing examples, so
  19.  * all I can do is make my version an ARexx variable.  I would be
  20.  * very grateful for concrete information about different "ls" options.
  21.  *
  22.  * To create a correct "ls-R" file the following format is essential:
  23.  *
  24.  *    <DEVICE>:<Current directory>
  25.  *    <All subdirectories of the current directory>
  26.  *    <All files in the current directory>
  27.  *
  28.  *    <DEVICE>:<First subdirectory of the current directory>
  29.  *    <All subdirectories of the first subdirectory of the CD>
  30.  *    <All files in the first subdirectory of the CD>
  31.  *
  32.  *    <DEVICE>:<Second subdirectory of the current directory>
  33.  *    <All subdirectories of the second subdirectory of the CD>
  34.  *    <All files in the second subdirectory of the CD>
  35.  *
  36.  * And so on.  If you really want to use a different "ls" program,
  37.  * try the one coming with AmiWeb2c with the "-1R" option and replace
  38.  * LSCOMMAND by an invocation string of your "ls" brand to produce
  39.  * such a list format.  For example, the UNIX version of "ls" is
  40.  * invoked with the "-LAR" option in the original "MakeTeXls-R".
  41.  */
  42. LSCOMMAND = "ls -1R"
  43.  
  44. Address COMMAND /* We use a lot of external commands */
  45.  
  46. /*
  47.  * Produce the top entries of "ls-R".  The "AmiWeb2c:" part will eventually
  48.  * be replaced by "./:"; Kpathsea will use relative file lookup.
  49.  */
  50. 'echo "AmiWeb2c:"  >' TEMPFILE
  51. 'echo "bibtex"    >>' TEMPFILE
  52. 'echo "dvips"     >>' TEMPFILE
  53. 'echo "etex"      >>' TEMPFILE
  54. 'echo "fonts"     >>' TEMPFILE
  55. 'echo "makeindex" >>' TEMPFILE
  56. 'echo "metafont"  >>' TEMPFILE
  57. 'echo "metapost"  >>' TEMPFILE
  58. 'echo "omega"     >>' TEMPFILE
  59. 'echo "pdftex"    >>' TEMPFILE
  60. 'echo "tex"       >>' TEMPFILE
  61. 'echo "web2c"     >>' TEMPFILE
  62.  
  63. /*
  64.  * The following entries are essential to a TDS-conforming installation.
  65.  * However, not all of these are always necessary, e.g., "fonts/type1"
  66.  * will only be used for PostScript fonts.
  67.  */
  68. DIRECTORIES = "bibtex dvips etex fonts/afm fonts/gf fonts/pk fonts/source"
  69. DIRECTORIES = DIRECTORIES "fonts/tfm fonts/type1 fonts/vf makeindex"
  70. DIRECTORIES = DIRECTORIES "metafont metapost omega pdftex tex web2c"
  71.  
  72. /*
  73.  * Apply "ls" to this set of (sub)directories one at a time, but only
  74.  * to existing entries.  This will create a temporary version of "ls-R".
  75.  */
  76. Parse Value DIRECTORIES With DIRECTORY DIRECTORIES
  77.  
  78. Do While "" ~= DIRECTORY
  79.   If Exists( DIRECTORY ) Then Do
  80.     'echo "" >>' TEMPFILE
  81.     LSCOMMAND '>>' TEMPFILE DIRECTORY
  82.   End
  83.   Parse Value DIRECTORIES With DIRECTORY DIRECTORIES
  84. End
  85.  
  86. /*
  87.  * Apply "sed" to the intermediate version of "ls-R" to fix the
  88.  * directory entries.  Three modifications are applied:
  89.  *
  90.  *    - Append a colon to all directories.
  91.  *    - Replace the current directory including
  92.  *      the device name with "dot-slash".
  93.  *    - Replace the top-most entry with "dot-slash-colon".
  94.  *      "There can be only one!".
  95.  */
  96. CURRENTDIR = Pragma( 'Directory' )
  97.  
  98. SEDCOMMAND = 'sed -e "s@\(.**\):\(.**\)@\1:\2:@"'
  99. SEDCOMMAND = SEDCOMMAND '-e "s@'CURRENTDIR'/@./@"'
  100. SEDCOMMAND = SEDCOMMAND '-e "s@\(.**\)::@./:@"'
  101. SEDCOMMAND = SEDCOMMAND TEMPFILE '>' OUTFILE
  102.  
  103. SEDCOMMAND /* Invoke this (long) command string */
  104.  
  105. /*
  106.  * Cleanup and Exit
  107.  */
  108. 'delete' TEMPFILE 'quiet'
  109.  
  110. Exit 0
  111.  
  112. /*
  113.  * End of program.
  114.  */
  115.